package com.seocoo.worker.user.login.model;

import com.seocoo.worker.base.entity.EFile;
import com.seocoo.worker.base.http.BaseRsp;
import com.seocoo.worker.base.http.ReqUploadFile;
import com.seocoo.worker.user.login.entity.EAdept;
import com.sfh.lib.IResultSuccess;
import com.sfh.lib.mvvm.BaseViewModel;

import java.io.File;
import java.util.List;

public class RegisterModel extends BaseViewModel {
    public void  uploadFile(int requestCode,String path){

        this.execute(false, new ReqUploadFile(new File(path)), stringBaseRsp -> {
            if (stringBaseRsp.success()){
                setValue("onFileScuess",requestCode,stringBaseRsp.getData());
            }else{
                showDialogToast(stringBaseRsp.getMsg());
            }
        });
    }

    public void register(ReqRegister register){
        this.execute(false, register, stringBaseRsp -> {
            if (stringBaseRsp.success()){
                setValue("onRegisterScuess");
            }else{
                showDialogToast(stringBaseRsp.getMsg());
            }
        });
    }

    /***
     * 擅长领域
     */
    public void queryAdeptList(){
        this.execute(false, new ReqAdept(), eAdepts -> {
            if (eAdepts.success()){
                setValue("onQueryAdeptListrScuess",eAdepts.getData());
            }else{
                showDialogToast(eAdepts.getMsg());
            }
        });
    }

    /***
     *  加盟流程
     */
    public void getPlatform(){

        this.execute(true, new ReqPlatform(), baseRsp -> {
            if (baseRsp.success()){
                setValue("onPlatform",baseRsp.getData().joinProcess);
            }else{
                showDialogToast(baseRsp.getMsg());
            }
        });
    }
}
